#ifndef _LOOMSERVER_H_

#define _LOOMSERVER_H_



#include <stdlib.h>

#include <stdio.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

#include <unistd.h>

#include <stdint.h>

#include <time.h>

#include <string.h>

#include <assert.h>


#ifdef _WIN32
#   include <windows.h>
#   include <winsock2.h>
#endif


#define MAX_COMPANYNUM 64
#define MAX_COLLECTORNUM 64
#define MAX_REPEATERNUM 128
#define SITE_DBNAME "netloomsite"
#define COMDB_PREFIX "comloom_"

#define CMD_EXITSERVER 0xFC
#define CMD_BUFFEROVER 0xFD
//////////////////////////
#define CMD_LOOMDATA 0xC2
#define CMD_SETTIME 0x94
#define CMD_TRANSDATA 0x96
#define CMD_REQCOMID  0x97
#define CMD_SENDCOMID 0xC6
#define CMD_REPLYTIME 0xC4
//complete received history data
#define CLI_HRECVDATA 0x83
#define CLI_SETTIMETM 0x94
#define CLI_GETCOMID  0xB6
#define CLI_GETRLDATA 0xB2


#define EVT_DOWN_SILK 201
#define EVT_

#define CAPACITY_SIZE 8192
#define MAX_VALUEBUF 66560
#define MAX_SQLBUF   67584

#define DATA_REALTM  1
#define DATA_HISTORY 2

#define MY_DTSAVEEV 1
#define MY_DTSAVEPH 2
#define MY_DTSAVERL 4
#define MY_DTSAVEST 8
#define MY_DTSAVEHI 16
//server and client time inaccuracy is five seconds
#define TIME_MAX_OFFSET 300

#define LOCALIP 16777343
#define HOSTIP 1762354863

#include "uv.h"

#include "loomtype.h"

#include "serverfunction.h"

#include "dbprocess.h"

#include "writedata.h"

#include "commutil.h"

company_attr_t g_companyattr[MAX_COMPANYNUM][MAX_REPEATERNUM];


#endif // _LOOMSERVER_H_

